package mqtt

import (
	"context"
	"micro-rulego/internal/broker"

	mqtt "github.com/eclipse/paho.mqtt.golang"
)

type optionsKey struct{}

func Options(opts *mqtt.ClientOptions) broker.Option {
	return func(o *broker.Options) {
		if o.Context == nil {
			o.Context = context.Background()
		}
		o.Context = context.WithValue(o.Context, optionsKey{}, opts)
	}
}
